//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "server\fn_serverSetupConquerCheck.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_parameters","_params","_id","_result"];
_parameters = _this;
_result = false;
if (IS_ARRAY(_parameters) && {count _parameters > 2}) then {
	_id = GETVAL(_parameters,0,"");
	_params = GETVAL(_parameters,2,[]);
	TRACE_1("Extracted",ARR_2(_id,_params));
	if (IS_ARRAY(_params) && {count _params > 0}) then {
		private ["_object","_action_id"];
		_object = GETVAL(_params,0,objNull);
		_action_id = GETVAL(_params,1,0);
		TRACE_1("Checking",ARR_2(_object,_action_id));
		if (!(isNull _object)) then {
			// TRACE_1(QGVAR(Conquer_Count),(_object getVariable ARR_2(format ARR_3("%1_%2",QGVAR(Conquer_Count),_action_id),0)) );
			// TRACE_1(QGVAR(Conquer_Timeout),(_object getVariable ARR_2(format ARR_3("%1_%2",QGVAR(Conquer_Timeout),_action_id),15)) );
			// TRACE_1(QGVAR(Conquer_Done),(_object getVariable ARR_2(format ARR_3("%1_%2",QGVAR(Conquer_Done),_action_id),false)) );
			_result = (((_object getVariable [format["%1_%2",QGVAR(Conquer_Count),_action_id],0]) <= (_object getVariable [format["%1_%2",QGVAR(Conquer_Timeout),_action_id],15])) && !(_object getVariable [format["%1_%2",QGVAR(Conquer_Done),_action_id],false]));
		};
	};
} else {
	TRACE_1("Missing Parameter");
};
TRACE_1("End",_result);
TMFPROFILERSTOP;
_result;